package cn.org.mrliu.ssm.util;

import java.util.List;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.github.pagehelper.PageInfo;

@SuppressWarnings("rawtypes")
public class Pagination extends PageInfo {
	private static final long serialVersionUID = 2196672203972720193L;
	public static Integer pageNums = 5;
	public Pagination() {
	}

	/**
	 * 包装Page对象
	 *
	 * @param list
	 */
	@SuppressWarnings("unchecked")
	public Pagination(List list) {
		super(list, pageNums);
	}

	/**
	 * 包装Page对象
	 *
	 * @param list
	 *            page结果
	 * @param navigatePages
	 *            页码数量
	 */
	@SuppressWarnings("unchecked")
	public Pagination(List list, int navigatePages) {
		super(list, navigatePages);
	}

	@Override
	public String toString() {
		String string = "<pre>Pagination";
//		string += JSON.toJSONString(this, true);
		string += JSON.toJSONString(this, 
				SerializerFeature.WriteMapNullValue,
				SerializerFeature.WriteNullStringAsEmpty,
				SerializerFeature.WriteDateUseDateFormat,
				SerializerFeature.WriteNullNumberAsZero,
				SerializerFeature.PrettyFormat);
		string += "</pre>";
		return string;
	}
	public static void main(String[] args) {
		System.out.println(new Pagination());
	}
}
